﻿using System.Web.Mvc;
using CodeContrib.Web.Mvc.Routing;

namespace CodeContribBlog.Web.Mvc.Areas.Admin
{
	public class AdminAreaRegistration : AreaRegistration
	{
		public override string AreaName
		{
			get { return "Admin"; }
		}

		public override void RegisterArea(AreaRegistrationContext context)
		{
			context.MapLowercaseRoute("Admin_Home", "admin", new
				                                                 {
					                                                 controller = "Home",
					                                                 action = "Index"
				                                                 }, new[]
					                                                    {
						                                                    "CodeContribBlog.Web.Mvc.Areas.Admin.Controllers"
					                                                    });

			context.MapLowercaseRoute("Admin_Default", "admin/{controller}/{action}/{id}", new
				                                                                               {
					                                                                               controller = "Home",
					                                                                               action = "Index",
					                                                                               id = UrlParameter.Optional
				                                                                               }, new
					                                                                                  {
						                                                                                  id = new PositiveIntegerRouteConstraint()
					                                                                                  }, new[]
						                                                                                     {
							                                                                                     "CodeContribBlog.Web.Mvc.Areas.Admin.Controllers"
						                                                                                     });
		}
	}
}